The necessity of managing two distinct access points (`front` and `rear`) means that the Queue structure is maintained by precisely updating these indices within the underlying storage. We will first examine the simple array-based implementation.
This basic model defines the core structure by using two indices: `front` (tracking the item to be removed) and `rear` (tracking the next available slot for insertion).
The required API operations for an array-backed queue include:
enQueue(item): The insertion operation. Places the item at the `rear` index, then increments `rear`.deQueue(): The removal operation. Retrieves the item at the `front` index, then increments `front`.is_Empty(): Checks iffront == rear.is_Full(): Checks if the queue has reached its maximum capacity (MAX_SIZE).
The Linear Problem
In this simple array model, both `front` and `rear` move strictly forward (increasing the index). If we remove an element from index 0, that space remains unused, leading to wasted space and potential premature overflow.